<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="7" :sm="8">
            <a-form-model-item label="部门" prop="deptName">
              <j-input v-model="queryParam.deptName" type="like"/>
            </a-form-model-item>
            <a-form-model-item label="部门负责人" prop="deptUserName">
              <j-input v-model="queryParam.deptUserName" type="like"/>
            </a-form-model-item>
          </a-col>
          <a-col :md="5" :sm="8">
            <a-form-model-item label="在职状态" prop="status">
              <j-search-select-tag placeholder="请选择" v-model="queryParam.status" :dictOptions="searchOptions">
              </j-search-select-tag>
            </a-form-model-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 modalForm-->
    <div class="table-operator">
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="processInstanceStatus" slot-scope="text, record">
          <p v-if="record.status == '3'">{{ record.processInstanceStatus}}(退回)</p>
          <p v-else>{{ record.processInstanceStatus}}</p>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEditZC(record)">变更资产管理员</a>
        </span>

      </a-table>
    </div>

    <AssetPerson-modal :isAudit="isAudit" ref="modalForm" @ok="modalFormOk"></AssetPerson-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import AssetPersonModal from './modules/AssetPersonModal'

export default {
  name: 'Preindexing',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    AssetPersonModal
  },
  data() {
    return {
      description: '资产管理员',
      isAudit:0,
      searchOptions:[{
          text:"全部",
          value:""
        },{
          text:"在职",
          value:"1"
        },{
          text:"离职",
          value:"5"
      }],
      // 表头
      columns: [
        {
          title: '部门名称',
          align: "center",
          dataIndex: 'deptName'
        },
        {
          title: '部门负责人',
          align: "center",
          dataIndex: 'deptUserName'
        },
        {
          title: '资产管理员',
          align: "center",
          dataIndex: 'assetsUserName'
        },
        {
          title: '资产管理员在职状态',
          align: "center",
          dataIndex: 'status',
          customRender: function (text) {
            if (text === '5') {
              return '已离职'
            } else {
              return '在职'
            }
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/assets/deptExt/list",
        delete: "/sys/user/delete",
      },
    }
  },
  created() {
  },
  computed: {
  },
  methods: {
    handleEditZC:function(record){
      this.$refs.modalForm.edit(record);
      this.$refs.modalForm.title = "编辑-资产管理员";
      this.$refs.modalForm.disableSubmit = false;
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>